export const toTime = (t: any) => {
  const time = new Date(t);
  const YY = time.getFullYear();
  const MM = time.getMonth();
  const dd = time.getDate();
  const hh = time.getHours();
  const mm = time.getMinutes();
  const ss = time.getSeconds();

  return (
    YY +
    "-" +
    (MM + 1 >= 10 ? MM + 1 : "0" + (MM + 1)) +
    "-" +
    (dd < 10 ? "0" + dd : dd) +
    " " +
    (hh < 10 ? "0" + hh : hh) +
    ":" +
    (mm < 10 ? "0" + mm : mm) +
    ":" +
    (ss < 10 ? "0" + ss : ss)
  );
};

export const toDate = (t: any) => {
  const time = new Date(t);
  const YY = time.getFullYear();
  const MM = time.getMonth();
  const dd = time.getDate();

  return (
    YY +
    "-" +
    (MM + 1 >= 10 ? MM + 1 : "0" + (MM + 1)) +
    "-" +
    (dd + 1 < 10 ? "0" + dd : dd)
  );
};
